﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using B10.Models;
using B10.Helpers;
using Telerik.Web.Mvc;

namespace B10.Controllers
{
    [HandleError]
    public class AuthorsController : Controller
    {
        IDatabaseRepository _db;

        public AuthorsController()
            : this(new DatabaseRepository())
        { }

        public AuthorsController(IDatabaseRepository db)
        {
            _db = db;
            _db.LazyLoading = false;
        }

        //
        // GET: /Authors/

        public ActionResult Index()
        {
            return View();
        }

        [GridAction]
        public ActionResult _AuthorsList()
        {
            var pages = _db.GetAll<UserProfile>();
            return View(new GridModel<UserProfile>()
            {
                Data = pages
            });
        }

    }
}
